{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "53a8c603-6666-4f5d-a6bf-cab6db2d197c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1d9a2464-06a5-4207-bee9-19ffc5efc19c",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.array([5,5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d2fd0031-ba54-4d2a-9260-b39801bca035",
   "metadata": {},
   "outputs": [],
   "source": [
    "y = np.array([2,2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "6327081d-5732-46d0-a615-c55116fc55d5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10, 10])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.multiply(x,y)###执行逐元素乘法的函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8e57f300-e56f-4fb3-8767-7d63f66a6067",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.dot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "bc2be7bc-b983-487b-8727-e76753989d09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2,)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "598098cd-0109-4c93-9b26-6b044ac0ffc9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2,)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "1b0c287d-411b-4abd-9b58-ef947d94e9ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5],\n",
       "       [5]])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.shape = 2,1\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "11473225-5ce7-4a9c-b23e-357bf3b6b15f",
   "metadata": {},
   "outputs": [],
   "source": [
    "y.shape = 1,2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "b649fc5c-9ef4-4824-93b9-35c7daf1896f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[2, 2]])"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "bb09f1e2-7ff7-4bf2-8190-65873eb50907",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5],\n",
       "       [5]])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "1fd070e2-daef-485b-89cf-f0dd70c0bab4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[10, 10],\n",
       "       [10, 10]])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.dot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "618f1942-3739-4767-9b33-e4b7a35d7ba3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[20]])"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.dot(y,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "ec7e03da-8d9a-4452-8ffc-f173327e66c0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1 2 3]\n",
      " [4 5 6]]\n"
     ]
    }
   ],
   "source": [
    "x = np.array([1,1,1])\n",
    "y = np.array([[1,2,3],[4,5,6]])\n",
    "print(x*y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "10425267-6a5c-41a2-a0a3-d9a73d4d71b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True,  True,  True, False])"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y = np.array([2,2,2,4])\n",
    "x = np.array([2,2,2,3])\n",
    "x == y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "bebfd3ab-5886-45aa-b91e-cf2bb7a5715e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True,  True,  True,  True])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.logical_and(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "450b671d-0059-4225-818a-ab3ce1d22311",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True,  True,  True,  True])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.logical_or(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "8fb25943-b30f-4fad-8c68-2681aa8ed628",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 0, 0])"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.logical_not(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a996a591-25ca-4c90-9dfd-0627ec597f95",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
